entID = nil
dir = 1

function update(dt)
    phys = entityMngr:getEntity(entID):getAsJumpingPhysic()
	
	if phys.normalCollision.x ~= 0 and phys.collideXWithNoSlope == true then
		dir = dir * (-1)
	end
	
	phys.jumpState = phys.jumpState + phys.jumpLength * dt;

	if phys.jumpState > 1 then
		phys.jumpState = 1
	end
	
	phys.moveDirection = Vec2f(dir * phys.speed, phys.jumpSpeed*phys.jumpState)
end

function init(i)
    entID = i
	graph = createModelGraphicComponent(entityMngr, entID)
	phys = createJumpingComponent(entityMngr, entID)
	life = createLifeComponent(entityMngr, entID)
	
	phys.sizeBox = Vec2f(20.0, 30.0)
	phys.jumpSpeed = 600.0
	phys.speed = 120
	phys.jumpLength = 3
	
	life.life = 200
	
	graph.model:loadModel("Data/tileGrass.mdl")
	
	renderSystem:addEntity(entID)
	physicSystem:addEntity(entID)
	damageSystem:addEntity(entID)
	
end
